package com.smartleanx.module.hrm.eums.employee;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

/**
 * 岗位调动类型
 *
 * @author tengcj
 * @since 2024/5/17
 */
@Getter
@RequiredArgsConstructor
public enum ChangeTypeEnum {

    /**
     * 调岗
     */
    CHANGE_POST(1, "调岗"),
    /**
     * 晋升
     */
    PROMOTED(2, "晋升"),
    /**
     * 降级
     */
    DEGRADE(3, "降级"),

    ;

    private final Integer code;

    private final String name;

    ChangeTypeEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    /**
     * 根据code返回desc
     *
     * @param code 编号
     * @return 名称
     */
    public static String getName(Integer code) {
        for (ChangeTypeEnum e : ChangeTypeEnum.values()) {
            if (e.getCode().equals(code)) {
                return e.getName();
            }
        }
        return null;
    }

}
